
const { mongoose } = require('../db');

const schema = mongoose.Schema({
    user: {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'User',
        autopopulate: true,
    },
    article: {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'Article',
        autopopulate: true,
    },
    deletedAt: { type: Date, default: null },
}, {
    timestamps: true,
});

schema.plugin(require('mongoose-autopopulate'));
module.exports = mongoose.model('Share', schema, 'share');